﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace cnFederal.Fa_Forms
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //var b = from c in lnq.FaNews
            //        select new
            //        {
            //            c.Id,
            //            c.Header,
            //            c.MainContent,
            //            c.Title,
            //            c.ImageUrl

            //        };
            //List<FaPost> liste = new List<FaPost>();
            //foreach (var s in b)
            //{
            //    FaPost news = new FaPost();
            //    news.Id = (int)s.Id;
            //    news.Header = (string)s.Header;
            //    news.MainContent = (string)s.MainContent;
            //    news.Title = (string)s.Title;
            //    news.ImageUrl = (string)s.ImageUrl;
            //    liste.Add(news);
            //}

            FaPosts.Load();
            Nations.Load("Farsi");
            listview1.DataSource = FaPosts.GetAllPostsFromDateToDate();
            listview1.DataBind();

        }

        public string GetShortDate(string datetime)
        {
            return Convert.ToDateTime(datetime).ToShortDateString();
        }
        protected void pager_click(object sender, EventArgs e)
        {
            int lastpage = this.DataPager1.StartRowIndex;
            DataPager1.SetPageProperties(lastpage, DataPager1.MaximumRows, false);

            listview1.DataBind();

        }
    }
}